import { MotionPlugin } from '@vueuse/motion'
import { createApp } from 'vue'

import VueTippy from 'vue-tippy'
import directives from '@/directives'

import icons from '@/plugins/icons'
import pinia from '@/store'
import { injectResponsiveStorage } from '@/utils/responsive'

import App from './App.vue'
import { getPlatformConfig } from './config'
import router from './router'

// 全局注册vue-tippy
import 'tippy.js/dist/tippy.css'
import 'tippy.js/themes/light.css'
// 引入重置样式
import 'normalize.css'
import './style/reset.scss'

// 导入公共样式
import './style/index.scss'
import '@wlydfe/pro-ui/theme-chalk/index.css'
// 配置unocss
import 'virtual:uno.css'

const app = createApp(App)

app.use(VueTippy)

getPlatformConfig(app).then(async config => {
  app.use(directives)
  app.use(icons)
  // app.use(motion)
  app.use(pinia)
  app.use(router)
  // await router.isReady()
  injectResponsiveStorage(app, config ?? {})
  app.use(MotionPlugin)

  app.mount('#app')
})
